package com.itfly.entity;

import lombok.Data;

import java.io.Serializable;

/**
 * 
 * @TableName t_product
 */
@Data
public class Product implements Serializable {
    /**
     * 自增主键id
     */
    private Integer pid;

    /**
     * 商品名称
     */
    private String pname;

    /**
     * 商品编号
     */
    private String pno;

    /**
     * 商品型号
     */
    private String pitem;

    /**
     * 商品单位
     */
    private String punit;

    /**
     * 商品单价
     */
    private Double price;

    /**
     * 商品图片
     */
    private String image;

    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Product other = (Product) that;
        return (this.getPid() == null ? other.getPid() == null : this.getPid().equals(other.getPid()))
            && (this.getPname() == null ? other.getPname() == null : this.getPname().equals(other.getPname()))
            && (this.getPno() == null ? other.getPno() == null : this.getPno().equals(other.getPno()))
            && (this.getPitem() == null ? other.getPitem() == null : this.getPitem().equals(other.getPitem()))
            && (this.getPunit() == null ? other.getPunit() == null : this.getPunit().equals(other.getPunit()))
            && (this.getPrice() == null ? other.getPrice() == null : this.getPrice().equals(other.getPrice()))
            && (this.getImage() == null ? other.getImage() == null : this.getImage().equals(other.getImage()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getPid() == null) ? 0 : getPid().hashCode());
        result = prime * result + ((getPname() == null) ? 0 : getPname().hashCode());
        result = prime * result + ((getPno() == null) ? 0 : getPno().hashCode());
        result = prime * result + ((getPitem() == null) ? 0 : getPitem().hashCode());
        result = prime * result + ((getPunit() == null) ? 0 : getPunit().hashCode());
        result = prime * result + ((getPrice() == null) ? 0 : getPrice().hashCode());
        result = prime * result + ((getImage() == null) ? 0 : getImage().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", pid=").append(pid);
        sb.append(", pname=").append(pname);
        sb.append(", pno=").append(pno);
        sb.append(", pitem=").append(pitem);
        sb.append(", punit=").append(punit);
        sb.append(", price=").append(price);
        sb.append(", image=").append(image);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}